package com.wenyu.wenyuyuedu.adapter.homepagefragment;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.bumptech.glide.Glide;
import com.wenyu.wenyuyuedu.viewholder.Homepage_All_Item_ViewHold;
import com.wenyu.wenyuyuedu.R;
import com.wenyu.wenyuyuedu.bean.homepager.Homepage_All_item;

import java.util.List;

/**
 * Created by Administrator on 2017/2/20. * 首页--全部的adapter
 */

public class HomePage_All_Adapter extends RecyclerView.Adapter {
    private Context context;
    private List<Homepage_All_item.InfoBean> infoList;
    public HomePage_All_Adapter(Context context, List<Homepage_All_item.InfoBean> infoList){
        this.context = context;
        this.infoList = infoList;
    }
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.homepage_all_item, parent, false);
        return new Homepage_All_Item_ViewHold(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        Homepage_All_item.InfoBean infoBean = infoList.get(position);
        Homepage_All_Item_ViewHold holder1 = (Homepage_All_Item_ViewHold) holder;
        Glide.with(context)
                .load(infoBean.getPath())
                .into(holder1.head_view);

    }

    @Override
    public int getItemCount() {
        return infoList.size();
    }
}
